home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / VGADOC4B.ZIP / WHATVGA.NOT < prev    next >
Text File  |  1995-09-29  |  7KB  |  124 lines

  1. This file contains my notes on some of the functions and features of video
  2. cards in general and the implemantation of WHATVGA in specific.
  3.  
  4.  
  5. Accessing video memory:
  6.   Standard VGA uses the 128K address space at A0000h-BFFFFh (B0000h-B7FFFh or
  7.   B8000h-BFFFFh for text modes, A0000h-AFFFFh for graphics modes and with an
  8.   option to use all 128K). As the 16color modes use a planar system where
  9.   several (typically 4) bytes are located at the same address the 64K space
  10.   at A0000h-AFFFFh can address the entire 256K bytes on the original VGA.
  11.   The problem is with mode 13h which does not use the planar system. On the
  12.   original VGA there is no "good" way to access all of memory in mode 13h.
  13.   Two work arounds are known: 1) Enable A0000h-BFFFFh (rather than the default
  14.   A0000h-AFFFFh) to access 128K, 2) Set the memory access) to planar mode but
  15.   keep the attribute controller in packed pixel mode. This is the basis for
  16.   the various "Mode X" implementations giving 360x200, 360x400 and similar
  17.   resolutions, of course drawing requires switching planes as pixel 0,1,2&3
  18.   are now in 4 separate planes. Both methods probably fails on some clones.
  19.  
  20.   The usual way to access video memory is through a window (often called bank).
  21.   A bank register controls which part of video memory can be accessed in the
  22.   window. The size and location of the window and the granularity of the bank
  23.   register depends on the chipset. Some chipsets supports two windows, either
  24.   as two separate windows, or by having separate read and write bank registers
  25.   so that copying from one location to another within the window area can
  26.   actualy copy from any location of video memory to another (This is what is
  27.   referred to as "Read/Write banks" in WHATVGA).
  28.  
  29.   The VESA VBE interface is a very general implementation of the above,
  30.   supporting 1 or 2 banks with separate size, location and read/write status.
  31.  
  32.   Another way of accessing video memory is to have it mapped as a contigous
  33.   block (usually called linear aperture). This block must be mapped above
  34.   system memory as most (=all) memory controllers (and operating systems) will
  35.   insist on mapping RAM as a solid block from 1M upwards. For ISA systems the
  36.   aperture must be mapped in the first 16MB which can seriously limit the
  37.   amount of RAM that can be in the system (often 12 or 14MB).
  38.   VESA bus systems often fail to implement some of the address pins in the
  39.   A26-A31 range, thus memory (on the bus) may be limited to 64 or 128Mb.
  40.   Note that motherboard VGAs are not limited by the external bus system!
  41.   Some chipsets (including all PCI systems) can map the aperture at a
  42.   programmable location while others maps at a fixed location (often because
  43.   the address is decoded by external logic with the result input to the VGA on
  44.   a single pin - Tseng ET4000, Cirrus CL-GD542x among others).
  45.  
  46.   Using the linear aperture requires a way to access memory above 1Mb, either
  47.   via INT 15h, AH=87h or one of the memory extender interfaces (VCPI, DPMI..)
  48.  
  49.  
  50. DAC access:
  51.   Usually the DAC registers are accessed at the 4 I/O address 3C6h-3C9h (VGA)
  52.   or 2E8h-2EBh (8514/A, ATI Mach8/32).
  53.   Most newer DACs uses (upto) 8 or 16 addresses and thus requires 1 or 2 extra
  54.   address lines. One way is to use one or two of the upper address lines
  55.   (A10-A15), since most I/O cards only decodes A0-A9 for I/O cycles.
  56.   This method is used with most older Compaq and Weitek cards, but is not
  57.   used much now because it doesn't fit well with the PCI configuration.
  58.   The other method is to use one or two I/O pins on the VGA chip controlled
  59.   from a register.
  60.  
  61.   The standard DAC registers (3C6h-3C9h) corresponds to the DAC registers
  62.   REG02,REG03,REG00 and REG01. The strange order comes from the fact that the
  63.   two lower address bits (A0 and A1) are connected directly to the RS0 and RS1
  64.   lines on the DAC and external logic ensure that the DAC chip select is only
  65.   active for the addresses 3C6h to 3C9h. Specifically:
  66.     I/O addr   A1(RS1)  A0(RS0)   DAC Chip Select   DAC Reg#
  67.       3C5h        0        1           No              ---
  68.       3C6h        1        0           Ok             REG02
  69.       3C7h        1        1           Ok             REG03
  70.       3C8h        0        0           Ok             REG00
  71.       3C9h        0        1           Ok             REG01
  72.       3CAh        1        0           No              ---
  73.  
  74.   There are systems where DAC access is through memory mapped registers.
  75.   Matrox, the newer Weiteks and the ATI Mach64 (optional) are examples.
  76.   A specific address corresponds to each of the 4/8/16/32 DAC addresses,
  77.   so that each access to this address causes a read or write of the
  78.   corresponding DAC address.
  79.  
  80.   The setDACpage/clearDACpage rutines works perfectly with the I/O based DAC
  81.   systems, whether they use upper address bits or VGA I/O bits, and they
  82.   interface easily to the various register and index rutines (wrinx...).
  83.  
  84.   However for the memory mapped DAC systems the rd/wr/clr/mod/setDACreg
  85.   rutines must be used, consequently all the DAC rutines should (and will
  86.   eventually) be changed to the *DACreg rutines.
  87.  
  88.   In standard VGA systems the DAC palette has 256 entries of 18bits (6bits
  89.   per basic color - Red, Green and Blue) allowing for 256 colors out of 256K.
  90.   Some DACs have (or can be configured for) 8bits per basic color, I.e. 256
  91.   entries of 24bits allowing 256 colors out of 16M colors.
  92.  
  93.   Some DACs can do Gamma Correction in Hi/True color modes, where the bits for
  94.   each basic color (Red, Green and Blue) are passed through the palette before
  95.   reaching the DAC. This allows you to use non-linear color scales to correct
  96.   color misrepresentation in the monitor, and of course also allows some of the
  97.   palette manipulation tricks usually reserved for palette modes (how does
  98.   flashing 24bit color sound ?).
  99.  
  100.  
  101.  
  102. Display Start Address:
  103.   The Display Start Address controls where in video memory the displayed
  104.   image starts (I.e. where the first pixel is located).
  105.   Standard VGA has 16bits in 3d4h index 0Ch and 0Dh, most all SVGA chipsets
  106.   have some extra bits.
  107.   The first problem is the resolution, usually this is 4 bytes in packed
  108.   modes (PK4 and >=256 colors), 1byte in planar (16 color VGA) modes (remember
  109.   there are 4 planes for each byte) and 2 bytes in text modes (again there are
  110.   4 planes per two bytes visible), however some chipsets have modes where
  111.   the resolution is different, typically 8 bytes in packed modes.
  112.   The other problem is how to scroll single pixels horizontally. As seen above
  113.   the Display Start Address is usually in units of 4 (packed) or 8 (planar)
  114.   pixels. Standard VGA has the pixel PEL register (3C0h index 13h) for single
  115.   pixel scrolling which also works for extended modes on most chipsets, but
  116.   there are some chipsets where this does not work for extended modes.
  117.   If single pixel horizontal scrolling does not work the screen will appear
  118.   to scroll in "jumps" of 2/4/8/16 pixels depending on chipset, mode and
  119.   bits per pixel which is annoying but not really a problem, however in 24bit
  120.   modes (P24 modes, NOT P32) which uses 3 bytes per pixel this will cause
  121.   dramatic color shifts when scrolling horizontally as the programmed starting
  122.   address is in multipla of 4 (or 8) bytes, but the pixels start on every
  123.   3rd byte
  124.